#include "AnalogClock.h"
#include "ui_AnalogClock.h"
#include "KeepThread.h"
#include <QDebug>

CAnalogClock::CAnalogClock(QWidget* parent)
	: QWidget(parent)
	, m_ui(new Ui::AnalogClock)
	, m_pThread(nullptr)
{
	m_ui->setupUi(this);
	if (m_pThread == nullptr)
	{
		m_pThread = new CKeepTime;
	}
	if (m_pThread)
	{
		connect(m_pThread, SIGNAL(sigTimeOut()), m_ui->graphicsView, SLOT(slotTimeOut()));
		m_pThread->start();
	}
}

CAnalogClock::~CAnalogClock()
{
	if (m_pThread)
	{
		m_pThread->setStopThread();
		m_pThread->quit();
		m_pThread->wait();
		delete m_pThread;
	}
	
	delete m_ui;
}


